

***************************************************************************************************
/* This is the master do file to replicate the analyses in the Paper 
	"The European Emissions Trading Scheme and Fuel Efficiency of Fossil Fuel Power Plants in Germany"
	by Robert Germeshausen
*/
***************************************************************************************************

clear all

*** Set paths:
* Dummy data set to create syntax (set accordingly):
cd "..."
* Datapath for statistical office (will be adjusted by the statistical office):
*cd "..."


*** Set current date
local aktuell = "..."
*** Start log file:
capture log close
log using "log_master_`aktuell'.log", replace
set linesize 200

*******************************************************
*** Title of Statistical Office Project: ... (set accordingly)
******************************************************
***
*** Request number: ... (set accordingly after data access is granted)
***
******************************************************
***
*** Data sources provided by statistical offices: 
* AFiD-Panel Energiebetriebe 2003-2012
* Jahresdaten des Monatsberichtes zur Elektrizitaetsversorgung der Anlagen fuer die allgemeine Versorgung 2003-2012
*
*
******************************************************
***
*** Data user: ... (set accordingly)
*** Contact: ... (set e-mail address accordingly)
***
*******************************************************



*******************************************************
*** Overview of do file
***
* 1. 	Data preparation 
* 
*
* 2. 	Generate descriptive statistics
*
*
* 3. 	Generate results
*
*
*
**********************************************************

*** Set stata version
version 11.1

*** Install packages, if neccessary
capture noisily ssc install mat2txt, replace
capture noisily ssc install tabstatmat, replace
capture noisily ssc install xtoverid, replace
capture noisily ssc install xtivreg2, replace
capture noisily ssc install ranktest, replace
capture noisily ssc install xtabond2, replace
capture noisily ssc install estout, replace


set more off

*** Read in data set
* Dummy data set to create and to check syntax:
use "....dta", clear
* Original data set provided by statistical office (path set by statistical office):
*use "....dta", clear

*** 1. Data preparation
mata: mata set matafavor space, perm
do 1_data_preparation
capture log close


*** 2. Descriptive Statistics 
log using "log_2_descriptive_`aktuell'.log", replace
do 2_descriptive
capture log close

*** 3. Results 
log using "log_3_results_`aktuell'.log", replace
do 3_results
capture log close



exit
